/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.worsik.android.test.rideshare.constants;

import java.util.Calendar;
import java.util.Date;

import cz.worsik.android.test.rideshare.util.KalendarTools;

/**
 *
 * @author 231260
 */
public class ViewConst {

    // Vybrane datum
    private static Date date;

	// debug mode
	public static final boolean DEBUG = true;
	
	// generovani checkboxu
	public static final int CHECKBOX_START_ID = 100;
	public static final int ROW_START_ID = 200;
	public static final int CHECKBOX_WIDTH = 140;
	public static final int CHECKBOX_HEIGHT = 40;
	public static int CHECKBOX_COUNT = 0;
	
	// generovani historie
	public static Boolean HISTORY_JIZDY_VISIBLE = false;
	public static Boolean HISTORY_PLATBY_VISIBLE = false;
	public static String HISTORY_DRIVER = "";
	public static String HISTORY_PASSENGER = "";
	
	// generovani popup window
	public static final int SPINNER_CONTACT = 301;
	public static final int SPINNER_DRIVER = 302;
	public static final int EDIT_AMOUNT = 303;
	
	// generovani tabulek pro bilance
	public static final int TABLE_BACKGROUND = 0xffaaaaaa;
	public static final int TITLE_BACKGROUND = 0xff555555;
	public static final int SUBTITLE_BACKGROUND = 0xff222222;
	public static final int CELL_BACKGROUND = 0xff000000;
	public static final int ROW_HEIGHT = 30;
	public static final int ROW_WIDTH = 288;
	
	// generovani nastaveni
	public static int SETTINGS_NAME_START_ID = 400;
	public static int SETTINGS_DRIVER_CHECK_START_ID = 500;
	public static int SETTINGS_PRICE_START_ID = 600;
	public static int SETTINGS_EDIT_BTN_START_ID = 700;
	public static int SETTINGS_EDIT_BTN2_START_ID = 800;

    public static Date getDate() {
        if (ViewConst.date == null)
            return new Date();
        else
            return ViewConst.date;
    }

    public static void setDate(Date date) {
        ViewConst.date = date;
    }

    public static Calendar getCalendar() {
        Calendar cal = Calendar.getInstance();
        cal.setTime(ViewConst.getDate());

        return cal;
    }

    public static void prevMonth()
    {
        Calendar c = ViewConst.getCalendar();
        c.add(Calendar.MONTH, -1);

        ViewConst.setDate(c.getTime());
    }

    public static void nextMonth()
    {
        Calendar c = ViewConst.getCalendar();
        c.add(Calendar.MONTH, +1);

        ViewConst.setDate(c.getTime());
    }

    public static void prevDay()
    {
        Calendar c = ViewConst.getCalendar();
        c.add(Calendar.DAY_OF_MONTH, -1);

        ViewConst.setDate(c.getTime());
    }

    public static void nextDay()
    {
        Calendar c = ViewConst.getCalendar();
        c.add(Calendar.DAY_OF_MONTH, +1);

        ViewConst.setDate(c.getTime());
    }

    public static void today()
    {
        ViewConst.setDate(getNow());
    }

    public static Date getNow() {
        return new Date();
    }

    public String getDen() {
        String den = ""+ViewConst.getCalendar().get(Calendar.DAY_OF_MONTH);
        if (den.length() == 1) {
            return "0"+den;
        }
        else {
            return ""+den;
        }
    }

    public static String getMesic() {
        return KalendarTools.mesice[ViewConst.getCalendar().get(Calendar.MONTH)];
    }

    public String getCisloMesice() {
        Integer cislo = ViewConst.getCalendar().get(Calendar.MONTH)+1;
        String string = cislo.toString();
        if (string.length() == 1) {
            return "0"+string;
        }
        else {
            return ""+string;
        }
    }

    public static String getRok() {
        return ""+ViewConst.getCalendar().get(Calendar.YEAR);
    }

}
